Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

223
Views
Postman returns [object object ] and value is not passing

I'm working with postman automation

There is a vehicles array in the body

{
   "Vehicles":[
      {
         "car":"{{car}}",
         "bike":"{{bike}}"
      }
   ]
}

I need to change this like below

{
   "Vehicles":"[{{vehicles}}]"
}

So I have created a pre=request script

let car, bike;
var vehicles = {
    car: data.vehicles.car,
    bike: data.vehicles.bike
}
pm.variables.set("vehicles",vehicles);

I'm getting data from external data file and its as following

[
   {
      "Vehicles":[
         {
            "car":"BMW",
            "bike":"YAMAHA"
         }
      ]
   }
]

I have run it through collection runner. and got the request body as vehicles:[object object] The data is not passing

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Here objects are coverted into a string. Due to this the string returned [object,object].Assuming you are using a JSON file for external source you can use JSON.stringify() to solve this. Change the following part of your code:

let car, bike;
var vehicles = {
    car: data.vehicles.car.stringify(),
    bike: data.vehicles.bike.stringify()
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!